Skip to content

Remove redundant FunctionalGroupInfo/MonomerRole redefinitions in reaction_detector.py#44

Merged
janitha-mahanthe merged 2 commits into25-v02-refactor-into-class-basedfrom
copilot/sub-pr-42-again
Mar 3, 2026
Merged

Remove redundant FunctionalGroupInfo/MonomerRole redefinitions in reaction_detector.py#44
janitha-mahanthe merged 2 commits into25-v02-refactor-into-class-basedfrom
copilot/sub-pr-42-again

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 3, 2026

reaction_detector.py imported FunctionalGroupInfo and MonomerRole from functional_groups_detector, then immediately redefined both classes locally—silently overriding the imports and creating two divergent class hierarchies with identical structure. Any object created by functional_groups_detector would be a different type than one created by reaction_detector, causing subtle isinstance/type-check failures at module boundaries.

Changes

  • Deleted the local FunctionalGroupInfo and MonomerRole dataclass definitions from reaction_detector.py
  • reaction_detector.py now consumes these types solely via the existing import from functional_groups_detector, which remains the single authoritative definition
# Before: import was immediately shadowed by local redefinitions
try:
    from .functional_groups_detector import FunctionalGroupInfo, MonomerRole
except (ImportError, ModuleNotFoundError):
    from functional_groups_detector import FunctionalGroupInfo, MonomerRole

@dataclass(slots=True, frozen=True)
class FunctionalGroupInfo:   # ← override; creates a separate type
    ...

@dataclass(slots=True, frozen=True)
class MonomerRole:           # ← override; creates a separate type
    ...

# After: imports are the only definitions; local redefinitions removed

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ons from reaction_detector.py

Co-authored-by: janitha-mahanthe <119646255+janitha-mahanthe@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Monomer Input Schema based on review feedback Remove redundant FunctionalGroupInfo/MonomerRole redefinitions in reaction_detector.py Mar 3, 2026
@janitha-mahanthe janitha-mahanthe marked this pull request as ready for review March 3, 2026 21:30
@janitha-mahanthe janitha-mahanthe merged commit 6b4af1a into 25-v02-refactor-into-class-based Mar 3, 2026
@janitha-mahanthe janitha-mahanthe deleted the copilot/sub-pr-42-again branch March 5, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants